<?php
namespace xing\privacyPhone\drive;

use xing\privacyPhone\core\PrivacyPhoneBase;
use xing\privacyPhone\core\PrivacyPhoneInterface;
use AlibabaCloud\SDK\Dyplsapi\V20170525\Dyplsapi;

use Darabonba\OpenApi\Models\Config;
use AlibabaCloud\SDK\Dyplsapi\V20170525\Models\BindAxbRequest;

/**
 * @property Dyplsapi $drive
 */
class AliPrivacyPhone extends PrivacyPhoneBase implements PrivacyPhoneInterface
{
    private $drive;

    /**
     * 使用AK&SK初始化账号Client
     * @param null $config
     * @return static
     */
    public static function init($config = null)
    {
        if (empty($config)) $config = (new static())->set;
        $class = new static;
        $drive = new Config($config);
        // 访问的域名
        $drive->endpoint = $config['endpoint'] ?? "dyplsapi.aliyuncs.com";
        $class->drive = new Dyplsapi($drive);
        return $class;
    }


    public function bindAxb($x, $a, $b, $expireSecond = 1800)
    {

        $class = static::init();
        if (empty($expireSecond)) $expireSecond = $this->expireSecond;
        $bindAxbRequest = new BindAxbRequest([]);
        return $class->drive->bindAxb($bindAxbRequest);
    }
}
